<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<!-- Include the standard tag library JSP -->
<%@ include file="/common/taglibs.jsp"%>
<script type="text/javascript">
function  fnTrim(str){
	return str.replace(/(^\s*)|(\s*$)/g,"");
}
function go(){
    var pagesize = document.getElementById("pagesize");
    var value = fnTrim(pagesize.value);//去掉首尾空格
    if(value==""){
      return;
    }
    if(isNaN(value)){
      alert('每页显示条数应为整数！');
      pagesize.value="";
	  pagesize.focus();
	  return;
    }else{
	var url = "${urlaction}?${urlParamWithoutPageSize}&pagesize="+value;
    window.location.href=url;
	}
}
</script>
<c:if test="${ !empty ITEMS_COLLECTION }">
总计${sum}条记录,每页:
<c:choose>
		<c:when test="${pagesize eq 20 }">20条|
</c:when>
		<c:otherwise>
			<a href="${urlaction}?${urlParamWithoutPageSize}&pagesize=20">20条</a>|
</c:otherwise>
	</c:choose>
	<c:choose>
		<c:when test="${pagesize eq 50 }">50条|
</c:when>
		<c:otherwise>
			<a href="${urlaction}?${urlParamWithoutPageSize}&pagesize=50">50条</a>|
</c:otherwise>
	</c:choose>
	<c:choose>
		<c:when test="${pagesize eq 100 }">100条|
</c:when>
		<c:otherwise>
			<a href="${urlaction}?${urlParamWithoutPageSize}&pagesize=100">100条</a>|
</c:otherwise>
	</c:choose>
	<input type="text" name="pagesize" id="pagesize" size="3" maxlength="3" />
	<input type="button" value="GO" onclick="go()" />
	<pg:pager maxIndexPages="${indexPages}" items="${sum}"
		maxPageItems="${pagesize}" url="${urlaction}"
		export="offset,currentPageNumber=pageNumber">
		<pg:index>
			<pg:first>
				<c:if test="${currentPageNumber != 1}">
					<A HREF="${pageUrl}&${urlParams}">首页</A>
				</c:if>
				<c:if test="${currentPageNumber == 1}">
                        			首页
                        		</c:if>
			</pg:first>
			<pg:prev>
				<a href="${pageUrl}&${urlParams}">上一页</a>
			</pg:prev>
			<pg:pages>
				<c:if test="${pageNumber==currentPageNumber}">
                            		${pageNumber}
                            	</c:if>
				<c:if test="${pageNumber!=currentPageNumber}">
					<a href="${pageUrl}&${urlParams}">${pageNumber}</a>
				</c:if>
			</pg:pages>
			<pg:next>
				<a href="${pageUrl}&${urlParams}">下一页</a>
			</pg:next>
			<pg:last>
				<c:if test="${currentPageNumber != pageNumber}">
					<A HREF="${pageUrl}&${urlParams}">末页</A>
				</c:if>
				<c:if test="${currentPageNumber == pageNumber}">
                            		末页
                            	</c:if>
                            	共${pageNumber}页
                            </pg:last>
		</pg:index>
	</pg:pager>
</c:if>
